Skip to contentSkip to conversation

Change in openvpn[master]: dco linux: avoid redefining ovpn enums

Openvpn-devel In review ralf_lici (Code Review) 2 participants 7 messages Jun 23, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1750684356000.I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email

to review the following change.

Change subject: dco linux: avoid redefining ovpn enums
......................................................................

dco linux: avoid redefining ovpn enums

Starting with Linux kernel version 6.16, a couple of ovpn-related enum definitions were introduced in the include/uapi/linux/if_link.h header. Redefining them in openvpn when they are already present in the system headers can lead to conflicts or build issues.

This commit ensures that enum redefinitions are avoided by conditionally using the existing definitions from the system header when available.

Change-Id I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425

---
M src/openvpn/dco_linux.h

1 file changed, 6 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/1064/1

src/openvpn/dco_linux.h +6 -1
index 273a6ad..f6e2d13 100644
@@ -40,6 +40,8 @@
 
 /* OVPN section */
 
+#ifndef IFLA_OVPN_MAX
+
 enum ovpn_mode {
     OVPN_MODE_P2P,
     OVPN_MODE_MP,
@@ -50,9 +52,12 @@
     IFLA_OVPN_MODE,
 
     __IFLA_OVPN_AFTER_LAST,
-    IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
 };
 
+#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1)
+
+#endif /* ifndef IFLA_OVPN_MAX */
+
 typedef struct
 {
     struct nl_sock *nl_sock;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425
Gerrit-Change-Number: 1064
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email

to look at the new patch set (#2).

Change subject: dco linux: avoid redefining ovpn enums
......................................................................

dco linux: avoid redefining ovpn enums

Starting with Linux kernel version 6.16, a couple of ovpn-related enum definitions were introduced in the include/uapi/linux/if_link.h header. Redefining them in openvpn when they are already present in the system headers can lead to conflicts or build issues.

This commit ensures that enum redefinitions are avoided by conditionally using the existing definitions from the system header when available.

Change-Id I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425

---
M src/openvpn/dco_linux.h

1 file changed, 7 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/1064/2

src/openvpn/dco_linux.h +7 -2
index 273a6ad..4e441ec 100644
@@ -40,6 +40,8 @@
 
 /* OVPN section */
 
+#ifndef IFLA_OVPN_MAX
+
 enum ovpn_mode {
     OVPN_MODE_P2P,
     OVPN_MODE_MP,
@@ -49,10 +51,13 @@
     IFLA_OVPN_UNSPEC = 0,
     IFLA_OVPN_MODE,
 
-    __IFLA_OVPN_AFTER_LAST,
-    IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
+    __IFLA_OVPN_MAX,
 };
 
+#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1)
+
+#endif /* ifndef IFLA_OVPN_MAX */
+
 typedef struct
 {
     struct nl_sock *nl_sock;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425
Gerrit-Change-Number: 1064
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, ralf_lici.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email )

Change subject: dco linux: avoid redefining ovpn enums
......................................................................

Patch Set 2: Code-Review+1

(1 comment)

Patchset:

PS2:
patch looks good to me, however the commit message says nothing about converting MAX from enum to define. I'd just add on line saying something like "While at it, convert ..._MAX to define, to reflect the way it is defined in kernel 6.16"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425
Gerrit-Change-Number: 1064
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ralf_lici <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Jun 2025 13:47:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#4 lore raw

PATCH v2 1/1 dco linux: avoid redefining ovpn enums

In reply to a message not in the archive

From: Ralf Lici <[email protected]...>

Starting with Linux kernel version 6.16, a couple of ovpn-related enum definitions were introduced in the include/uapi/linux/if_link.h header. Redefining them in openvpn when they are already present in the system headers can lead to conflicts or build issues.

This commit ensures that enum redefinitions are avoided by conditionally using the existing definitions from the system header when available.

Change-Id I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1064
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):

src/openvpn/dco_linux.h +7 -2
index 273a6ad..4e441ec 100644
@@ -40,6 +40,8 @@
 
 /* OVPN section */
 
+#ifndef IFLA_OVPN_MAX
+
 enum ovpn_mode {
     OVPN_MODE_P2P,
     OVPN_MODE_MP,
@@ -49,10 +51,13 @@
     IFLA_OVPN_UNSPEC = 0,
     IFLA_OVPN_MODE,
 
-    __IFLA_OVPN_AFTER_LAST,
-    IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
+    __IFLA_OVPN_MAX,
 };
 
+#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1)
+
+#endif /* ifndef IFLA_OVPN_MAX */
+
 typedef struct
 {
     struct nl_sock *nl_sock;
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: dco linux: avoid redefining ovpn enums

Patch looks good, and passes compile & smoke tests on Ubuntu 20.04 (with and without --disable-dco) & Gentoo. No other platforms affected.

BB fails are due to infra issues (socks server refusing v6), unrelated to this patch.

Your patch has been applied to the master branch.

commit 1d3c2b67a73a0aa011c13e62f876d24e49d41df0

Author: Ralf Lici
Date:   Mon Jun 23 16:07:43 2025 +0200
     dco linux: avoid redefining ovpn enums

     Signed-off-by: Ralf Lici <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg31961.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#3) to the change originally created by ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email )

The following approvals got outdated and were removed:
Code-Review+1 by ordex

Change subject: dco linux: avoid redefining ovpn enums
......................................................................

dco linux: avoid redefining ovpn enums

Starting with Linux kernel version 6.16, a couple of ovpn-related enum definitions were introduced in the include/uapi/linux/if_link.h header. Redefining them in openvpn when they are already present in the system headers can lead to conflicts or build issues.

This commit ensures that enum redefinitions are avoided by conditionally using the existing definitions from the system header when available.

Change-Id I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31961.html

---
M src/openvpn/dco_linux.h

1 file changed, 7 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/1064/3

src/openvpn/dco_linux.h +7 -2
index 273a6ad..4e441ec 100644
@@ -40,6 +40,8 @@
 
 /* OVPN section */
 
+#ifndef IFLA_OVPN_MAX
+
 enum ovpn_mode {
     OVPN_MODE_P2P,
     OVPN_MODE_MP,
@@ -49,10 +51,13 @@
     IFLA_OVPN_UNSPEC = 0,
     IFLA_OVPN_MODE,
 
-    __IFLA_OVPN_AFTER_LAST,
-    IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
+    __IFLA_OVPN_MAX,
 };
 
+#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1)
+
+#endif /* ifndef IFLA_OVPN_MAX */
+
 typedef struct
 {
     struct nl_sock *nl_sock;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425
Gerrit-Change-Number: 1064
Gerrit-PatchSet: 3
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email )

Change subject: dco linux: avoid redefining ovpn enums
......................................................................

dco linux: avoid redefining ovpn enums

Starting with Linux kernel version 6.16, a couple of ovpn-related enum definitions were introduced in the include/uapi/linux/if_link.h header. Redefining them in openvpn when they are already present in the system headers can lead to conflicts or build issues.

This commit ensures that enum redefinitions are avoided by conditionally using the existing definitions from the system header when available.

Change-Id I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31961.html

---
M src/openvpn/dco_linux.h

1 file changed, 7 insertions(+), 2 deletions(-)
src/openvpn/dco_linux.h +7 -2
index 273a6ad..4e441ec 100644
@@ -40,6 +40,8 @@
 
 /* OVPN section */
 
+#ifndef IFLA_OVPN_MAX
+
 enum ovpn_mode {
     OVPN_MODE_P2P,
     OVPN_MODE_MP,
@@ -49,10 +51,13 @@
     IFLA_OVPN_UNSPEC = 0,
     IFLA_OVPN_MODE,
 
-    __IFLA_OVPN_AFTER_LAST,
-    IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
+    __IFLA_OVPN_MAX,
 };
 
+#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1)
+
+#endif /* ifndef IFLA_OVPN_MAX */
+
 typedef struct
 {
     struct nl_sock *nl_sock;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1064?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425
Gerrit-Change-Number: 1064
Gerrit-PatchSet: 3
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged